home *** CD-ROM | disk | FTP | other *** search
- on ReadLogText
- global gShortFlag, gCurrLog, gShortReportList, gCurrLogText, gTotLog, gCurrLine, gTotLines, gMaxLines, gLogPathList, gArancio
- set gCurrLine to 1
- if gTotLog > 1 then
- set NumLog to " " & string(gCurrLog)
- else
- set NumLog to EMPTY
- end if
- if gShortFlag then
- set gCurrLogText to string(getAt(gShortReportList, gCurrLog))
- set gTotLines to the number of lines in gCurrLogText
- set the title of window (the pathName & the movieName) to "Short Log" & NumLog
- else
- LeggiFileLog()
- set gTotLines to the number of lines in gCurrLogText
- set theFileName to ExtractFileNameFromPath(getAt(gLogPathList, gCurrLog))
- set the title of window (the pathName & the movieName) to "Log File" & NumLog & ":" && theFileName
- end if
- put line 1 to gMaxLines of gCurrLogText into field "fReport"
- end
-
- on LeggiFileLog
- global gCurrLog, gLogPathList, gCurrLogText
- if voidp(gLogPathList) then
- exit
- end if
- set maxListPath to count(gLogPathList)
- if maxListPath < 1 then
- exit
- end if
- if (gCurrLog < 1) or (gCurrLog > maxListPath) then
- exit
- end if
- set theLogFilePath to getAt(gLogPathList, gCurrLog)
- set myFileName to QUOTE & ExtractFileNameFromPath(theLogFilePath) & QUOTE
- if OSIsDirectory(theLogFilePath) = 0 then
- if (GetType(theLogFilePath) = "TEXT") and (GetCreator(theLogFilePath) = "ttxt") then
- set file to new(xtra("fileio"))
- if objectp(file) then
- openFile(file, theLogFilePath, 1)
- set gCurrLogText to readFile(file)
- closeFile(file)
- set file to 0
- end if
- else
- set gCurrLogText to "Type or Creator of File Log" && myFileName && "not valid."
- end if
- else
- set gCurrLogText to "File Log" && myFileName && "not available."
- end if
- end
-
- on ExtractFileNameFromPath myPath
- global gSep
- set oldDelimiter to the itemDelimiter
- set the itemDelimiter to gSep
- if the last char in myPath = gSep then
- delete char -30000 of myPath
- end if
- set myReturn to the last item in myPath
- set the itemDelimiter to oldDelimiter
- return myReturn
- end
-
- on GetType myFile
- set myType to Sinistra(OSGetFileInfo(myFile), 4)
- return myType
- end
-
- on GetCreator myFile
- set myCreator to Destra(OSGetFileInfo(myFile), 4)
- return myCreator
- end
-
- on Sinistra stringa, Valore
- set lun to length(stringa)
- if Valore > lun then
- set Valore to lun
- end if
- if (Valore > 0) and (Valore <= lun) then
- return char 1 to Valore of stringa
- end if
- end
-
- on Centro stringa, inizio, fine
- set lun to length(stringa)
- if voidp(fine) then
- set fine to lun
- end if
- if (inizio > 0) and (fine <= lun) then
- return char inizio to fine of stringa
- end if
- end
-
- on Destra stringa, Valore
- set lun to length(stringa)
- if Valore > lun then
- set Valore to lun
- end if
- if (Valore >= 0) and (Valore <= lun) then
- set pos to lun - Valore + 1
- return char pos to lun of stringa
- end if
- end
-